// ###############################################
//
// AUTHOR: Nick LaPrell (http://nick.laprell.org)  
//
// Sets the given box elements to the same
// width and height based on the max size of each.
//
// JQuery.equalize(type)
//   Sets the given group of elements to the same
//   width and height. Type is defined as "width,"
//  "height," or "both."
//
// ###############################################

jqPlugins.equalize = true;

(function($){

  $.fn.equalize = function(type) {  
    var type = type === undefined ? "both" : type;
    var width = 0;
    var height = 0;
    this.each(function(){
      if($(this).height() > height){height = $(this).height();}
      if($(this).width() > width){width = $(this).width();}
    });
    return this.each(function() {
      if(type == "both" || type == "width"){$(this).width(width);}
      if(type == "both" || type == "height"){$(this).height(height);}
    });  
  }; 
})(jQuery);